package cn.com.api.mapper.base;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Delete;  
import org.apache.ibatis.annotations.Insert;  
import org.apache.ibatis.annotations.Select;  
import org.apache.ibatis.annotations.Update; 

import cn.com.api.entity.ApiT_city;

//DAO
public interface T_cityMapperBase {

	//根据id查看
    @Select("SELECT * FROM t_city  WHERE id = #{id}")
	public ApiT_city findT_cityById(Integer id);
	
    //查看数据集
    @Select("SELECT * FROM t_city")
	public List<ApiT_city> findT_citys();
	
	//添加
    @Insert("INSERT INTO t_city (name, uname, is_effect, is_delete, pid, is_open, is_default, description, notice, seo_title, seo_keyword, seo_description, sort, u_name, is_hot, longitude, latitude, send_distance, open_time, address, contacts, tel, is_auto_allocateorder, same_distance,send_fouraward,send_fiveaward,return_goods_time,sendlimit,sendfee) VALUES (#{name}, #{uname}, #{is_effect}, #{is_delete}, #{pid}, #{is_open}, #{is_default}, #{description}, #{notice}, #{seo_title}, #{seo_keyword}, #{seo_description}, #{sort}, #{u_name}, #{is_hot}, #{longitude}, #{latitude}, #{send_distance}, #{open_time}, #{address}, #{contacts}, #{tel}, #{is_auto_allocateorder}, #{same_distance}, #{send_fouraward}, #{send_fiveaward}, #{return_goods_time},#{sendlimit},#{sendfee})")
 	public int insertT_city(ApiT_city t_city);
  	
	//修改
    @Update("UPDATE t_city SET name = #{name}, uname = #{uname}, is_effect = #{is_effect}, is_delete = #{is_delete}, pid = #{pid}, is_open = #{is_open}, is_default = #{is_default}, description = #{description}, notice = #{notice}, seo_title = #{seo_title}, seo_keyword = #{seo_keyword}, seo_description = #{seo_description}, sort = #{sort}, u_name = #{u_name}, is_hot = #{is_hot}, longitude = #{longitude}, latitude = #{latitude}, send_distance = #{send_distance}, open_time = #{open_time}, address = #{address}, contacts = #{contacts}, tel = #{tel}, is_auto_allocateorder=#{is_auto_allocateorder}, same_distance=#{same_distance}, send_fouraward=#{send_fouraward}, send_fiveaward=#{send_fiveaward}, return_goods_time=#{return_goods_time}, sendlimit=#{sendlimit}, sendfee=#{sendfee}  WHERE id = #{id}")
    public int updateT_city(ApiT_city t_city);
    
    //删除
    @Delete("DELETE FROM t_city  WHERE id = #{id}")
    public int deleteT_city(Integer id);
 
    // Foreign keys revelant		
		

	//region Indexs revelant
    
    
    //获取根据is_open	
    @Select("SELECT id, name, uname, is_effect, is_delete, pid, is_open, is_default, description, notice, seo_title, seo_keyword, seo_description, sort, u_name, is_hot, longitude, latitude, send_distance, open_time, address, contacts, tel FROM t_city  WHERE is_open = #{is_open}")	
    public List<ApiT_city> findT_citysByIs_open(String is_open);
    		
    //获取根据pid	
    @Select("SELECT id, name, uname, is_effect, is_delete, pid, is_open, is_default, description, notice, seo_title, seo_keyword, seo_description, sort, u_name, is_hot, longitude, latitude, send_distance, open_time, address, contacts, tel FROM t_city  WHERE pid = #{pid}")	
    public List<ApiT_city> findT_citysByPid(String pid);
    		
    //获取根据sort	
    @Select("SELECT id, name, uname, is_effect, is_delete, pid, is_open, is_default, description, notice, seo_title, seo_keyword, seo_description, sort, u_name, is_hot, longitude, latitude, send_distance, open_time, address, contacts, tel FROM t_city  WHERE sort = #{sort}")	
    public List<ApiT_city> findT_citysBySort(String sort);
    		
    //获取根据uname	
    @Select("SELECT id, name, uname, is_effect, is_delete, pid, is_open, is_default, description, notice, seo_title, seo_keyword, seo_description, sort, u_name, is_hot, longitude, latitude, send_distance, open_time, address, contacts, tel FROM t_city  WHERE uname = #{uname}")	
    public List<ApiT_city> findT_citysByUname(String uname);
    		
    
}


